//
//  StrategyCollectionViewCell.m
//  BJS151148_ TeamProject_Travel
//
//  Created by lanou3g on 16/3/22.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "StrategyCollectionViewCell.h"

@implementation StrategyCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initLayout];
    }
    return self;
}

- (void)initLayout{
    [self.contentView addSubview:self.backImageView];
    [self.backImageView addSubview:self.CNameLabel];
    [self.backImageView addSubview:self.ENameLabel];
    [self.backImageView addSubview:self.numLocationLabel];
}

- (UIImageView *)backImageView{
    if (_backImageView == nil) {
        _backImageView = [[UIImageView alloc]initWithFrame:CGRectMake(2, 10, [UIScreen mainScreen].bounds.size.width / 2 - 11, [UIScreen mainScreen].bounds.size.height / 2 - 150)];
        _backImageView.layer.cornerRadius = 8;
        _backImageView.layer.masksToBounds = YES;
    }
    return _backImageView;
}

- (UILabel *)CNameLabel{
    if (_CNameLabel == nil) {
        _CNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, CGRectGetWidth(_backImageView.frame), 40)];
        _CNameLabel.textColor = [UIColor whiteColor];
        _CNameLabel.font = [UIFont systemFontOfSize:20];
        _CNameLabel.numberOfLines = 0;
    }
    return _CNameLabel;
}

- (UILabel *)ENameLabel{
    if (_ENameLabel == nil) {
        _ENameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(_CNameLabel.frame) - 20, CGRectGetWidth(_backImageView.frame) - 20, 40)];
        _ENameLabel.textColor = [UIColor whiteColor];
        _ENameLabel.font = [UIFont systemFontOfSize:15];
    }
    return _ENameLabel;
}

- (UILabel *)numLocationLabel{
    if (_numLocationLabel == nil) {
        _numLocationLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetWidth(_backImageView.frame) / 4 , CGRectGetHeight(_backImageView.frame) - 40, CGRectGetWidth(_backImageView.frame) / 2, 30)];
        _numLocationLabel.textColor = [UIColor whiteColor];
        _numLocationLabel.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:0.6];
        _numLocationLabel.layer.cornerRadius = 8;
        _numLocationLabel.layer.borderWidth = 0.1;
        _numLocationLabel.layer.masksToBounds = YES;
        _numLocationLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _numLocationLabel;
}

@end
